import { CATEGORY_REGION, ADD_CATEGORY, ADD_REGION, DELETE_CATEGORY, DELETE_REGION, UPDATE_CATEGORY, UPDATE_REGION, FENCE_TREEDATA, FENCEDATA, VEHICLE_TABLE_ASSOCIATION } from './api'
import { METHOD, request } from '@/utils/request'

/**
 * 分类区域搜索
 * */
export async function getCategoryRegion(params) {
    return request(CATEGORY_REGION, METHOD.POST, params)
}
/**
 * 新增分类
 * @returns {Promise<AxiosResponse<T>}
 */
export async function addCategory(params) {
    return request(ADD_CATEGORY, METHOD.POST, params)
}
/**
* 新增区域
* @returns {Promise<AxiosResponse<T>}
*/
export async function addRegion(params) {
    return request(ADD_REGION, METHOD.POST, params)
}
/**
* 删除分类
* @returns {Promise<AxiosResponse<T>}
*/
export async function deleteCategory(id) {
    return request(`${DELETE_CATEGORY}/${id}`, METHOD.GET)
}
/**
* 删除区域
* @returns {Promise<AxiosResponse<T>}
*/
export async function deleteRegion(id) {
    return request(`${DELETE_REGION}/${id}`, METHOD.GET)
}
/**
* 修改分类
* @returns {Promise<AxiosResponse<T>}
*/
export async function updateCategory(params) {
    return request(UPDATE_CATEGORY, METHOD.POST, params)
}
/**
* 修改区域
* @returns {Promise<AxiosResponse<T>}
*/
export async function updateRegion(params) {
    return request(UPDATE_REGION, METHOD.POST, params)
}
/**
 * 获取分类区域树
 * @param type
 * @returns {Promise<AxiosResponse<T>}
 */
export async function getFenceTree(params) {
    return request(FENCE_TREEDATA, METHOD.POST, params)
}
/**
 * 根据区域id获取电子围栏
 * @returns {Promise<AxiosResponse<T>}
 */
export async function getFenceData() {
    return request(FENCEDATA, METHOD.GET)
}
// 车辆选择提示
export async function carNumAassociation(params) {
    return request(`${VEHICLE_TABLE_ASSOCIATION}/${params}`, METHOD.GET)
}

